package main;

/**
 * 
 * @author Dylan
 * 
 * Initialize program, create window, and set all the threads a-running. This
 * system uses separate threads for the model, view and controller, so that all
 * three processes are completely independent.
 *
 */

import javax.swing.JFrame;

public class Init {
	static View view;
	static Model model;
	static Controller controller;

	static JFrame window;

	static final int WIDTH = 500;
	static final int HEIGHT = 500;
	static final String TITLE = "Window";

	public static void sleep(int interval) {
		try {
			Thread.sleep(interval);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {

		window = new JFrame(TITLE);
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		controller = Controller.createController(window);
		model = Model.createModel(controller);
		view = new View(WIDTH, HEIGHT, model);
		window.add(view);

		window.pack();
		window.setVisible(true);

		while (true) {
			sleep(10);
			window.repaint();
		}
	}
}
